﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Petaframe.Caching
{
    public interface ICache<TKey, TItem>
     where TKey : IEquatable<TKey>
    {
        void Add(TKey key, TItem item, BaseToken token);
        void Add(TKey key, TItem item);
        void AddIfNotExists(TKey key, Func<TItem> getvalues, BaseToken token);
        void AddRange(Func<System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TItem>>> getRange, BaseToken token);
        void AddRange(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TItem>> items, BaseToken token);
        void BeginAddRange();
        bool ContainsKey(TKey key);
        long Count();
        void EndAddRange();
        TItem Get(TKey key);
        TItem GetWithCreate(TKey key, Func<TItem> createItem, BaseToken token);
        void Remove(TKey key);
        void Reset();
        bool TryGet(TKey key, out TItem outItem);
        Action OnReset { get; set; }
    }
}
